<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <script>
      var arr = [12, 432, 132, 323, 436, 36, 2]
      var s = 0
      for (i = 0; i < arr.length - 1; i++) {
        var indexA = i
        for (j = i + 1; j < arr.length; j++) {
          if (arr[indexA] > arr[j]) {
            indexA = j
          }
        }
        s = arr[i] + arr[indexA]
        arr[i] = s - arr[i]
        arr[indexA] = s - arr[i]
      }
      console.log(arr)
    </script>
  </body>
</html>
